package com.aaa.dem1104.d01;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

/**
 * @Author: whj
 * @Version 1.0
 * @Date: 2022/11/4  9:47
 */

/**
 * 静态方法引用
 */
public class Test {
    public static void main(String[] args) {
        ArrayList list = new ArrayList();
        list.add(1);
        list.add(5);
        list.add(3);
        list.add(4);
        list.add(2);

        //Comparator<Integer> comparator=(o1, o2) -> Integer.compare(o1,o2);
        Comparator<Integer> comparator=Integer::compare;
        Collections.sort(list,comparator);
        System.out.println("list = " + list);
    }
}
